package com.zhentao.schedule.file.config;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Date 2024/5/9 10:05
 * @Author xdm
 **/
@Data
@EnableConfigurationProperties(MinioConfigProperties.class)
public class MinioConfig {

    @Autowired
    private MinioConfigProperties minioConfigProperties;

    @Bean
    public MinioClient buildMinioClient() {

        return MinioClient.builder()
                .credentials(minioConfigProperties.getAccessKey(), minioConfigProperties.getSecretKey())
                .endpoint(minioConfigProperties.getEndpoint())
                .build();

    }

}